package com.ck.demo;

import java.util.concurrent.CompletableFuture;

public class CompleteableFutureDemo {

    public static void main(String[] args) {
        System.out.println("小明进店了");
        CompletableFuture.runAsync( () -> printThread("小明点了餐了"));
        System.out.println("小明在玩手机等");
    }

    public static void printThread(String msg){
        try {
            Thread.sleep(10000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("我等待了10秒之后出现了"+msg);
    }
}
